<template>
	<view>
		<view class="u-p-20">
			<view class="bg_FFFFFF u-b-r-16 u-p-20">
				<view v-for="(item,index) in list" :key="index" class="u-p-t-20 u-p-b-20"
					style="border-bottom: 1rpx solid #EAEAEA;">
					<view class=" u-flex">
						<u-image :src="item.logo" mode="aspectFit" width="80rpx" height='80rpx' shape="circle">
						</u-image>
						<view class=" u-m-l-20">
							<view class="u-flex u-w-570 u-row-between">
								<view class="u-flex">
									<view class="u-weight u-font-28">{{item.name}}</view>
								</view>
							</view>
							<view class="u-m-t-10 u-font-26 u-flex u-row-between">
								<view class="">{{item.mobile}}</view>
								<view style="color: #898989;">{{item.create_time}}注册</view>
							</view>
						</view>
					</view>
					<view class="u-m-t-20">
						<view class="u-m-t-20 u-flex">
							<view @click="$com.makePhoneCall(item.mobile)" class="u-flex">
								<u-image src="https://www.sqkjkj.vip/wxImg/clear/img2.png" mode="aspectFill"
									width="28rpx" height='28rpx'>
								</u-image>
								<view class="u-m-l-10 u-font-26"><text class="cl_898989FF">电话:</text>{{item.mobile}}
								</view>
							</view>
							<view @click="$com.setClipboardData(item.wechat)" class="u-flex u-m-l-20">
								<u-image src="https://www.sqkjkj.vip/wxImg/clear/wx.png" mode="aspectFill" width="28rpx"
									height='28rpx'>
								</u-image>
								<view class="u-m-l-10 u-font-26 u-m-r-20"><text
										class="cl_898989FF">微信:</text>{{item.wechat}}
								</view>
								<u-image src="https://www.sqkjkj.vip/wxImg/clear/img3.png" mode="aspectFill"
									width="28rpx" height='28rpx'>
								</u-image>
							</view>
						</view>
						<view @click="openLocation(item)" class="u-flex u-col-top u-m-t-20 ">
							<u-image src="https://www.sqkjkj.vip/wxImg/clear/img4.png" mode="aspectFill" width="28rpx"
								height='28rpx'></u-image>
							<view class="u-m-l-10 u-font-26 u-m-r-20">
								<text class="cl_898989FF">地址:</text>{{item.area+item.address}}
								<u-icon class="u-m-l-10" name="map-fill" color="#13b658" size="30"></u-icon>
							</view>
						</view>
					</view>
				</view>
				</view>
			</view>
			<!-- 加载更多 -->
			<u-loadmore :status="status" icon-type="circle" margin-bottom="20" />
		</view>
</template>

<script>
	export default {
		data() {
			return {
				list: [],
				params: {
					page: 1,
					page_size: 20
				},
				status: 'loadmore'
			}
		},
		onLoad(obj) {
			this.clear()
			this.agent_shop_list()
		},
		// 下拉到底事件
		onReachBottom() {
			//避免多次触发
			if (this.status == 'loading' || this.status == 'nomore') {
				return;
			}
			this.agent_shop_list();
		},
		methods: {
			clear() {
				this.list = [];
				this.params.page = 1;
			},
			// 获取商品列表
			async agent_shop_list() {
				await this.$api.agent_shop_list(this.params, res => {
					if (res.data.code == 1) {
						if (res.data.data.data.length < 20) {
							this.status = 'nomore';
						} else {
							this.params.page = this.params.page + 1;
							this.status = 'loadmore';
						}
						this.list = this.list.concat(res.data.data.data);
						uni.stopPullDownRefresh();
					}
				})
			},
			openLocation(item){
				this.$com.openLocation(Number(item.latitude),Number(item.longitude))
			}
		}
	}
</script>

<style scoped>
	page {
		background-color: #f5f5f5;
	}
</style>
